<?php
	class TagController extends CommonController{
		private $model;
		private $tag;
		public function __init(){
			$this->model=K('tag');
			$this->tag=$this->model->allData();
		}
		public function index(){
			// p($this->tag);
			$this->assign('tag',$this->tag);
			$this->display();
		}
		public function add(){
			if(IS_POST){
				// p($_POST);
				// $data=array();
				$data=$this->model->addData();
				// p($data);
				if($data){
					$this->success('添加成功');
				}else{
					$this->error('添加失败');
				}
			}else{
				$this->display();
			}
		}
		public function edit(){
			// p($_POST);
			if($this->model->editData()){
				$this->success('修改成功');
			}else{
				$this->error('修改失败');
			};
		}
		public function del(){
			if($this->model->delData()){
				$this->success('删除成功');
			}else{
				$this->error('删除失败');
			}
			// echo Q('tid');
			// echo '213';
			// echo $_GET['tid'];
		}
		public function cache(){
			if($this->model->cacheData()){
				$this->success('更新缓存成功');
			}else{
				$this->error('更新缓存失败');
			}
		}
	}

?>